/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nodeLevelMetaModel.impl;

import nodeLevelMetaModel.MemberRole;
import nodeLevelMetaModel.NodeLevelMetaModelPackage;
import nodeLevelMetaModel.TemporalAggregationTask;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Temporal Aggregation Task</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link nodeLevelMetaModel.impl.TemporalAggregationTaskImpl#getTimeWindow <em>Time Window</em>}</li>
 *   <li>{@link nodeLevelMetaModel.impl.TemporalAggregationTaskImpl#getDuration <em>Duration</em>}</li>
 *   <li>{@link nodeLevelMetaModel.impl.TemporalAggregationTaskImpl#getName18 <em>Name18</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TemporalAggregationTaskImpl extends AggregationTaskImpl implements TemporalAggregationTask {
	/**
	 * The default value of the '{@link #getTimeWindow() <em>Time Window</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeWindow()
	 * @generated
	 * @ordered
	 */
	protected static final int TIME_WINDOW_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getTimeWindow() <em>Time Window</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeWindow()
	 * @generated
	 * @ordered
	 */
	protected int timeWindow = TIME_WINDOW_EDEFAULT;

	/**
	 * The default value of the '{@link #getDuration() <em>Duration</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDuration()
	 * @generated
	 * @ordered
	 */
	protected static final int DURATION_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getDuration() <em>Duration</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDuration()
	 * @generated
	 * @ordered
	 */
	protected int duration = DURATION_EDEFAULT;

	/**
	 * The cached value of the '{@link #getName18() <em>Name18</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName18()
	 * @generated
	 * @ordered
	 */
	protected MemberRole name18;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TemporalAggregationTaskImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return NodeLevelMetaModelPackage.Literals.TEMPORAL_AGGREGATION_TASK;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getTimeWindow() {
		return timeWindow;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeWindow(int newTimeWindow) {
		int oldTimeWindow = timeWindow;
		timeWindow = newTimeWindow;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__TIME_WINDOW, oldTimeWindow, timeWindow));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getDuration() {
		return duration;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDuration(int newDuration) {
		int oldDuration = duration;
		duration = newDuration;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__DURATION, oldDuration, duration));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MemberRole getName18() {
		if (name18 != null && name18.eIsProxy()) {
			InternalEObject oldName18 = (InternalEObject)name18;
			name18 = (MemberRole)eResolveProxy(oldName18);
			if (name18 != oldName18) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__NAME18, oldName18, name18));
			}
		}
		return name18;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MemberRole basicGetName18() {
		return name18;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName18(MemberRole newName18) {
		MemberRole oldName18 = name18;
		name18 = newName18;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__NAME18, oldName18, name18));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__TIME_WINDOW:
				return getTimeWindow();
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__DURATION:
				return getDuration();
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__NAME18:
				if (resolve) return getName18();
				return basicGetName18();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__TIME_WINDOW:
				setTimeWindow((Integer)newValue);
				return;
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__DURATION:
				setDuration((Integer)newValue);
				return;
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__NAME18:
				setName18((MemberRole)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__TIME_WINDOW:
				setTimeWindow(TIME_WINDOW_EDEFAULT);
				return;
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__DURATION:
				setDuration(DURATION_EDEFAULT);
				return;
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__NAME18:
				setName18((MemberRole)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__TIME_WINDOW:
				return timeWindow != TIME_WINDOW_EDEFAULT;
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__DURATION:
				return duration != DURATION_EDEFAULT;
			case NodeLevelMetaModelPackage.TEMPORAL_AGGREGATION_TASK__NAME18:
				return name18 != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (timeWindow: ");
		result.append(timeWindow);
		result.append(", duration: ");
		result.append(duration);
		result.append(')');
		return result.toString();
	}

} //TemporalAggregationTaskImpl
